//
//  YJUtils.m
//  UTEDemo
//
//  Created by caofuqing on 2022/9/29.
//  Copyright © 2022 vv. All rights reserved.
//

#import "YJUtils.h"

@implementation YJUtils
/**持续时间
 获取两个时间的间隔
 */
+ (long long)getDurationStartTime:(NSString *)startTime endTime:(NSString *)endTime {
    if (startTime && endTime) {
        NSDateFormatter *strDateStr = [[NSDateFormatter alloc]init];
        [strDateStr setDateFormat:@"yyyy-MM-dd-HH-mm"];
        NSDate *startdate = [strDateStr dateFromString:startTime];
        NSDate *enddate = [strDateStr dateFromString:endTime];
        //时间转时间戳的方法:
        NSTimeInterval aTime = [enddate timeIntervalSinceDate:startdate];
        return (long long)aTime;
    } else {
        return -1;
    }
}
@end
